package errcode

var E struct {
	Base struct {
		Authorization    Status
		Forbidden        Status
		RequestInvalid   Status
		ResourceNotFound Status
		ErrorMessage     Status
	}
	Format struct {
		ContentType Status
	}
	Internal struct {
		Internal Status
	}
	Quota struct {
		Volume Status
	}
	Collection struct {
		Create Status
		Query  Status
		Modify Status
		Exist  Status
	}
	Mint struct {
		MintFailed Status
	}
	Burn struct {
		BurnFailed Status
	}

	Certification struct {
		InsufficientPermission Status
		HavaNotLogin           Status
	}
	Asset struct {
		AppliedFailed 	Status
		UpdateFailed  	Status
		Authorization    Status
	}
	File struct {
		SaveFailed     Status
		DownloadFailed Status
	}
	Mode struct {
		SharedModeNotSupport Status
	}
}

func init() {
	initErrorCode()
}

func initErrorCode() {
	// 输入参数错误，返回前端错误提示信息
	E.Base.ErrorMessage = Status{
		Code: 200, ErrorCode: "BCS.01400001", ErrorMessage: "Input invalid."}
	E.Base.Authorization = Status{
		Code: 400, ErrorCode: "BCS.01401001", ErrorMessage: "Authorization failed."}
	E.Base.Forbidden = Status{
		Code: 403, ErrorCode: "BCS.01403001", ErrorMessage: "Forbidden."}
	E.Base.RequestInvalid = Status{
		Code: 400, ErrorCode: "BCS.01400001", ErrorMessage: "Invalid request."}
	E.Base.ResourceNotFound = Status{
		Code: 404, ErrorCode: "BCS.01404001", ErrorMessage: "Resource not found."}
	E.Format.ContentType = Status{
		Code: 400, ErrorCode: "BCS.01400006", ErrorMessage: "Content type not supported."}
	E.Internal.Internal = Status{
		Code: 500, ErrorCode: "BCS.01500001", ErrorMessage: "Internal error"}
	E.Quota.Volume = Status{
		Code: 400, ErrorCode: "BCS.01400015", ErrorMessage: "Insufficient volume quota."}
	E.Collection.Create = Status{
		Code: 400, ErrorCode: "BCS.01400016", ErrorMessage: "Collection create failed."}
	E.Collection.Query = Status{
		Code: 400, ErrorCode: "BCS.01400017", ErrorMessage: "Collection query failed."}
	E.Collection.Modify = Status{
		Code: 400, ErrorCode: "BCS.01400018", ErrorMessage: "Collection modify failed."}
	E.Mint.MintFailed = Status{
		Code: 200, ErrorCode: "BCS.01400019", ErrorMessage: "Mint failed."}
	E.Burn.BurnFailed = Status{
		Code: 400, ErrorCode: "BCS.01400020", ErrorMessage: "Burn failed."}
	E.Collection.Exist = Status{
		Code: 400, ErrorCode: "BCS.01400021", ErrorMessage: "collectionIndex has been used."}
	E.Certification.HavaNotLogin = Status{
		Code: 401, ErrorCode: "BCS.01400022", ErrorMessage: "have not log in"}
	E.Certification.InsufficientPermission = Status{
		Code: 403, ErrorCode: "BCS.01400024", ErrorMessage: "insufficient permission to access the resource"}
	E.Asset.AppliedFailed = Status{
		Code: 200, ErrorCode: "BCS.01400030", ErrorMessage: "apply asset failed."}
	E.Asset.UpdateFailed = Status{
		Code: 200, ErrorCode: "BCS.01400031", ErrorMessage: "update asset relation failed."}
	E.File.SaveFailed = Status{
		Code: 200, ErrorCode: "BCS.01400032", ErrorMessage: "save file failed."}
	E.File.DownloadFailed = Status{
		Code: 200, ErrorCode: "BCS.01400033", ErrorMessage: "download file failed."}
	E.Mode.SharedModeNotSupport = Status{
		Code: 200, ErrorCode: "BCS.01400034", ErrorMessage: "shared mode not support."}
	E.Asset.Authorization = Status{
		Code: 201, ErrorCode: "BCS.01400001", ErrorMessage: "Authorization failed."}
}
